package com.kexio.enterprise.integration.message.result;

import com.kexio.enterprise.integration.message.enums.MessageStatus;

import java.time.LocalDateTime;
import java.util.Map;

/**
 * 消息发送结果
 * 
 * @author Kexio
 * @since 1.0.0
 */
public class MessageSendResult {
    private boolean success;
    private String messageId;
    private MessageStatus status;
    private String providerId; // 第三方服务商ID
    private String errorCode;
    private String errorMessage;
    private LocalDateTime sendTime;
    private long cost; // 发送耗时（毫秒）
    private Map<String, Object> responseData;

    public MessageSendResult() {
        this.sendTime = LocalDateTime.now();
    }

    public MessageSendResult(boolean success, String messageId) {
        this();
        this.success = success;
        this.messageId = messageId;
        this.status = success ? MessageStatus.SENT : MessageStatus.FAILED;
    }

    // Getters and Setters
    public boolean isSuccess() { return success; }
    public void setSuccess(boolean success) { this.success = success; }
    
    public String getMessageId() { return messageId; }
    public void setMessageId(String messageId) { this.messageId = messageId; }
    
    public MessageStatus getStatus() { return status; }
    public void setStatus(MessageStatus status) { this.status = status; }
    
    public String getProviderId() { return providerId; }
    public void setProviderId(String providerId) { this.providerId = providerId; }
    
    public String getErrorCode() { return errorCode; }
    public void setErrorCode(String errorCode) { this.errorCode = errorCode; }
    
    public String getErrorMessage() { return errorMessage; }
    public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; }
    
    public LocalDateTime getSendTime() { return sendTime; }
    public void setSendTime(LocalDateTime sendTime) { this.sendTime = sendTime; }
    
    public long getCost() { return cost; }
    public void setCost(long cost) { this.cost = cost; }
    
    public Map<String, Object> getResponseData() { return responseData; }
    public void setResponseData(Map<String, Object> responseData) { this.responseData = responseData; }
}
